package org.batatasframework.web.element;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class ElementCollection<Ele> {
	private final List<Ele> items = new ArrayList<>();
	
	public Ele get(int index){
		return items.get(index);
	}
	
	public int add(Ele ele){
		items.add(ele);
		return size();
	}
	
	public int size(){
		return items.size();
	}
	
	public int add(Ele[] eles){
		if(null != eles){
			Collections.addAll(items, eles);
		}
		return size();
	}
	
	@Override
	public String toString() {
		StringBuilder html = new StringBuilder();
		for(Ele body : items){
			html.append(body);
		}
		return html.toString();
	}
}
